package com.nanhang.service.Impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nanhang.common.util.PageResult;
import com.nanhang.entity.SEmployee;
import com.nanhang.mapper.SEmployeeMapper;
import com.nanhang.service.ISEmployeeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nanhang.vo.SemployeeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jsj
 * @since 2025-01-09
 */
@Service
public class SEmployeeServiceImpl extends ServiceImpl<SEmployeeMapper, SEmployee> implements ISEmployeeService {





    @Override
    public PageResult<SEmployee> search(Integer page, Integer pageSize, SemployeeVo vo) {

        QueryWrapper<SEmployee> wrapper = new QueryWrapper<>();
        wrapper.like(StrUtil.isNotBlank(vo.getEmployeeName()), "employee_name", vo.getEmployeeName());
        wrapper.like(StrUtil.isNotBlank(vo.getEmployeeSex()), "employee_sex", vo.getEmployeeSex());
        wrapper.like(StrUtil.isNotBlank(vo.getEmployeeTitle()), "employee_title", vo.getEmployeeTitle());

        Page<SEmployee> page1 = this.page(new Page<>(page, pageSize), wrapper);



        return new PageResult<>(page1.getRecords(),page1.getTotal());
    }
}
